package cn.fzkj.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @DESCRIPTION redisson作为分布式锁的配置
 * @Author yaya
 * @DATE 2022/5/28
 */
@Configuration
public class RedissonConfig {

    @Bean(name = "redisson")
    public RedissonClient getRedissonClient(){
        // 默认连接地址 127.0.0.1:6379
        Config config = new Config();
        config.useSingleServer().setAddress("redis://101.35.196.199:6379");
        config.useSingleServer().setPassword("xs_bSy00");
        RedissonClient redisson = Redisson.create(config);
        return redisson;
    }
}
